# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=vhostscan
pkgver=347.acc7890
_pyver=3.13
pkgrel=1
pkgdesc='A virtual host scanner that can be used with pivot tools, detect catch-all scenarios, aliases and dynamic default pages.'
groups=('blackarch' 'blackarch-scanner')
arch=('any')
url='https://github.com/codingo/VHostScan'
license=('GPL3')
depends=('python' 'python-requests' 'python-numpy' 'python-argparse'
         'python-pandas' 'python-dnspython' 'python-fuzzywuzzy'
         'python-argparse' 'python-urllib3' 'python-simplejson')
makedepends=('git' 'python-setuptools' 'python-pip' 'python-wheel')
source=("$pkgname::git+https://github.com/codingo/VHostScan.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's/==.*//g' requirements.txt
  sed -i 's/num_installed/NUM_INSTALLED/' setup.py
  #sed -i 's/numpy==1.12.0/numpy/g' setup.py
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  mv "$pkgdir/usr/bin/VHostScan" "$pkgdir/usr/bin/$pkgname"

  rm -rf "$pkgdir/usr/lib/python$_pyver/site-packages/tests" \

  find "$pkgdir" -type d -name '__pycache__' -exec rm -rf {} +
}

